package com.ruoyi.iot.enums;

import lombok.Getter;

/**
 * 规则执行动作类型枚举
 * deviceOutput: 设备输出
 * reportError: 上报告警
 * reportNotice: 上报通知
 *
 * @author Howe
 * @since 2025/7/17
 */
@Getter
public enum ActionTypeEnum {
  DEVICE_OUTPUT("deviceOutput", "设备输出"),
  REPORT_ERROR("reportError", "上报告警"),
  REPORT_NOTICE("reportNotice", "上报通知");

  private final String type;
  private final String name;

  ActionTypeEnum(String type, String name) {
    this.type = type;
    this.name = name;
  }

    public static ActionTypeEnum fromType(String type) {
    for (ActionTypeEnum value : ActionTypeEnum.values()) {
      if (value.type.equals(type)) {
        return value;
      }
    }
    throw new IllegalArgumentException("未知的规则执行动作类型: " + type);
  }
}